/* GUI CONVERTED from rcrp14.p (converter v1.75) Mon Nov 13 12:59:57 2000 */
/* rcrp14.p - VERIFY SHIPPER STRUCTURE REPORT                                 */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*K1B3*/ /*V8:ConvertMode=Report                                              */
/* REVISION: 8.6    LAST MODIFIED: 09/20/96          BY: TSI *K005*           */
/* REVISION: 8.6    LAST MODIFIED: 11/27/96          BY: *K02L* Chris Theisen */
/* REVISION: 8.6    LAST MODIFIED: 11/20/97          BY: bvm *K1B3*           */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane            */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan           */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* myb                  */
/* REVISION: 9.1    LAST MODIFIED: 09/04/00   BY: *N0RB* BalbeerS Rajput      */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

         {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcrp14_p_1 "Message!Number"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcrp14_p_2 "Address"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcrp14_p_3 "Message!Sequence"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcrp14_p_4 "Execution!Program"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcrp14_p_5 "Site"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcrp14_p_6 "Severity!Level"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

         /* LOCAL VARIABLES */
         define variable adaddr like ad_addr no-undo.
         define variable sisite like si_site no-undo.
         define variable dock_id as character no-undo.
         define variable shipto_id as character no-undo.
         define variable cust_id as character no-undo.
         define variable site as character no-undo.
         define variable address as character no-undo.
         define variable callpgm like umsg_call_pgm no-undo.
/*K02L*/ define variable run_file as character no-undo.

         /*SHARED WORKFILES*/
/*K02L*  COMMENT OUT - BEGIN
.        define new shared workfile wf_umsg_det no-undo
.           field wf_umsg_site like umsg_site
.           field wf_umsg_addr like umsg_addr
.           field wf_umsg_nbr like umsg_nbr
.           field wf_umsg_seq like umsg_seq
.           field wf_umsg_level like umsg_level
.           field wf_umsg_exec_pgm like umsg_exec_pgm.
.*K02L*  COMMENT OUT - END */

/*K02L*  WF_UMSG_DET - BEGIN */
         define new shared workfile wf_umsg_det no-undo
            field wf_umsg_site as character     label {&rcrp14_p_5}
            field wf_umsg_addr as character     label {&rcrp14_p_2}
            field wf_umsg_nbr as integer        column-label {&rcrp14_p_1}
            field wf_umsg_seq as integer
            field wf_umsg_level as integer
            field wf_umsg_exec_pgm as character column-label {&rcrp14_p_4}.
/*K02L*  WF_UMSG_DET - END */

         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
            
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
sisite              colon 17
            si_desc             no-label
            adaddr              colon 17
            ad_name             no-label
            ad_type
            callpgm             colon 17
            skip(1)
         with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* SET EXTERNAL LABELS */
         setFrameLabels(frame a:handle).

         find si_mstr
            where si_site = global_site
            no-lock no-error.

         find ad_mstr
            where ad_addr = global_addr
            no-lock no-error.

         assign
            sisite = if available si_mstr then si_site else ""
            adaddr = if available ad_mstr then ad_addr else "".

/*K1B3*/ {wbrp01.i}

         MAINLOOP:
         repeat with frame a:

/*K1B3*/   if c-application-mode <> 'web' then
           prompt-for sisite adaddr callpgm editing:

               if frame-field = "sisite" then
               do:
                  {mfnp05.i si_mstr si_site
                  "true" si_site "input sisite"}

                  if recno <> ? then
                  display
                     si_site @ sisite
                     si_desc.

               end.

               else
               if frame-field = "adaddr" then
               do:
                  {mfnp05.i ad_mstr ad_addr
                  "true" ad_addr "input adaddr"}

                  if recno <> ? then
                  display
                     ad_addr @ adaddr
                     ad_name
                     ad_type.

               end.

               else
               do:
                  status input.
                  readkey.
                  apply lastkey.
               end.

            end.  /* prompt-for editing */

/*K1B3*/ {wbrp06.i &command = prompt-for &fields = " sisite adaddr callpgm  "
                  &frm = "a"}

/*K1B3*/ if (c-application-mode <> 'web') or
/*K1B3*/    (c-application-mode = 'web' and
/*K1B3*/    (c-web-request begins 'data')) then do:

            /* CHECK FOR VALID SITE */
            find si_mstr
               where si_site = input sisite
               no-lock no-error.

            if not available si_mstr
               and input sisite <> "" then
            do:

               /* SITE DOES NOT EXIST */
               {mfmsg.i 708 3}
/*K1B3*/       if c-application-mode = 'web' then return.
/*K1B3*/       else next-prompt sisite.
               undo, retry.

            end.

            /* CHECK FOR VALID ADDRESS */
            find ad_mstr
               where ad_addr = input adaddr
               no-lock no-error.

            if not available ad_mstr
               and input adaddr <> "" then
            do:

               /* ADDRESS DOES NOT EXIST */
               {mfmsg.i 980 3}
/*K1B3*/       if c-application-mode = 'web' then return.
/*K1B3*/       else next-prompt adaddr.
               undo, retry.

            end.

/*K02L*/    {gprun.i ""gprunck.p"" "(input (input callpgm),
/*K02L*/                             output run_file)"}

/*K02L*     if search(input callpgm) = ? then */
/*K02L*/    if input callpgm <> ""
/*K02L*/       and run_file = "" then
            do:
               /* FILE DOES NOT EXIST */
               {mfmsg.i 53 3}
/*K1B3*/       if c-application-mode = 'web' then return.
/*K1B3*/       else next-prompt callpgm.
               undo, retry.
            end.

            display
               if available si_mstr then si_site else "" @ sisite
               if available si_mstr then si_desc else "" @ si_desc
               if available ad_mstr then ad_addr else "" @ adaddr
               if available ad_mstr then ad_name else "" @ ad_name
               if available ad_mstr then ad_type else "" @ ad_type.

/*K1B3*/ end.

            {mfselprt.i "printer" 132}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.

            {mfphead2.i}

            assign
               global_addr = adaddr
               global_site = sisite
               callpgm
               dock_id     = ""
               shipto_id   = ""
               cust_id     = "".

            find ad_mstr
               where ad_addr = input adaddr
               no-lock no-error.

 /*K02L*/   if available ad_mstr
 /*K02L*/      and ad_type = "customer" then
 /*K02L*/      cust_id = ad_addr.

            repeat while available ad_mstr
               and ad_type <> "customer":

               assign
                  dock_id   = if ad_type = "dock"
                                 then ad_addr else dock_id
                  shipto_id = if ad_type = "ship-to"
                                 then ad_addr else shipto_id
                  cust_id   = if ad_type = "ship-to"
                                 then ad_ref else cust_id.

               find ad_mstr
                  where ad_addr = ad_ref
                  no-lock no-error.

            end. /* repeat while available ad_mstr */

            assign
               site    = "," + input sisite
               address = "," + cust_id + "," + shipto_id + "," + dock_id.

            {gprun.i ""rcvrf01.p"" "(input address,
                                     input site,
                                     input callpgm)"}

        for each wf_umsg_det
               no-lock
               by wf_umsg_seq
/*N0RB*        by wf_umsg_nbr: */
/*N0RB*/       by wf_umsg_nbr with frame f-a:

               /* SET EXTERNAL LABELS */
/*N0RB*/       setFrameLabels(frame f-a:handle).

/*K02L*/       {gprun.i ""gprunck.p"" "(input wf_umsg_exec_pgm,
/*K02L*/                                output run_file)"}

/*K02L*        if search(wf_umsg_exec_pgm) = ? then */
/*K02L*/       if run_file = "" then
                  wf_umsg_exec_pgm = "*" + wf_umsg_exec_pgm.

               display
                  wf_umsg_site
                  wf_umsg_addr
                  wf_umsg_seq       column-label {&rcrp14_p_3}
/*K02L*           wf_umsg_nbr       column-label "Message!Number" */
/*K02L*/          wf_umsg_nbr       format ">>>9"
/*K02L*           wf_umsg_exec_pgm  column-label "Execution!Program" */
/*K02L*/          wf_umsg_exec_pgm  format "x(10)"
                  wf_umsg_level     column-label {&rcrp14_p_6} WITH STREAM-IO /*GUI*/ .

            end. /* for each wf_umsg_det */

            {mfrtrail.i}

         end.
/*K1B3*/ {wbrp04.i &frame-spec = a}
